package javabase.singleton;

public final class SynLazySingletonLight {
	private static SynLazySingletonLight LazySingleton = null;
	private SynLazySingletonLight () {
		
	}
	public static SynLazySingletonLight getLazySingleton() {
		if (LazySingleton == null) {
			synchronized (SynLazySingletonLight.class) {
				// 防止指令重排方法一
				SynLazySingletonLight tmp = LazySingleton;
				if (tmp == null) {
					tmp = new SynLazySingletonLight();
					LazySingleton = tmp;
				}
			}
			LazySingleton = new SynLazySingletonLight();
		}
		return LazySingleton;
	}
}
